#include <iostream>
#include "Comm.hpp"

using namespace std;

int main()
{
    int wfd = open(Path, O_WRONLY);
    if (wfd < 0)
    {
        cerr << "open errno,errno: " << errno << ", errstring: " << strerror(errno) << endl;
        return 1;
    }

    string inbuffer;
    while (true)
    {
        cout << "please Enter Your Message# ";
        getline(cin, inbuffer);
        if(inbuffer=="quit")    break;
        ssize_t n = write(wfd, inbuffer.c_str(), sizeof(inbuffer));
        if (n < 0)
        {
            cerr << "write errno,errno: " << errno << ", errstring: " << strerror(errno) << endl;
            break;
        }
    }

    close(wfd);

    return 0;
}